/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.cosmact.vxml.model.impl;

import org.cosmact.vxml.model.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory {
	/**
         * Creates the default factory implementation.
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public static ModelFactory init() {
                try {
                        ModelFactory theModelFactory = (ModelFactory)EPackage.Registry.INSTANCE.getEFactory("model"); 
                        if (theModelFactory != null) {
                                return theModelFactory;
                        }
                }
                catch (Exception exception) {
                        EcorePlugin.INSTANCE.log(exception);
                }
                return new ModelFactoryImpl();
        }

	/**
         * Creates an instance of the factory.
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public ModelFactoryImpl() {
                super();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public EObject create(EClass eClass) {
                switch (eClass.getClassifierID()) {
                        case ModelPackage.DOCUMENT: return createDocument();
                        case ModelPackage.DIALOG_TYPE: return createDialogType();
                        case ModelPackage.DIALOG_XML_CONTENT: return createDialogXmlContent();
                        case ModelPackage.DIALOG: return createDialog();
                        case ModelPackage.DIALOG_CONNECTION: return createDialogConnection();
                        case ModelPackage.DIALOG_CONNECTION_TYPE: return createDialogConnectionType();
                        default:
                                throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
                }
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
                switch (eDataType.getClassifierID()) {
                        case ModelPackage.EDIALOG_TYPE:
                                return createEDialogTypeFromString(eDataType, initialValue);
                        case ModelPackage.ECONNECTION_TYPE:
                                return createEConnectionTypeFromString(eDataType, initialValue);
                        case ModelPackage.EVOICE_XML_NAMES:
                                return createEVoiceXmlNamesFromString(eDataType, initialValue);
                        default:
                                throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
                }
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
                switch (eDataType.getClassifierID()) {
                        case ModelPackage.EDIALOG_TYPE:
                                return convertEDialogTypeToString(eDataType, instanceValue);
                        case ModelPackage.ECONNECTION_TYPE:
                                return convertEConnectionTypeToString(eDataType, instanceValue);
                        case ModelPackage.EVOICE_XML_NAMES:
                                return convertEVoiceXmlNamesToString(eDataType, instanceValue);
                        default:
                                throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
                }
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public Document createDocument() {
                DocumentImpl document = new DocumentImpl();
                return document;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public DialogType createDialogType() {
                DialogTypeImpl dialogType = new DialogTypeImpl();
                return dialogType;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public DialogXmlContent createDialogXmlContent() {
                DialogXmlContentImpl dialogXmlContent = new DialogXmlContentImpl();
                return dialogXmlContent;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public Dialog createDialog() {
                DialogImpl dialog = new DialogImpl();
                return dialog;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public DialogConnection createDialogConnection() {
                DialogConnectionImpl dialogConnection = new DialogConnectionImpl();
                return dialogConnection;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public DialogConnectionType createDialogConnectionType() {
                DialogConnectionTypeImpl dialogConnectionType = new DialogConnectionTypeImpl();
                return dialogConnectionType;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public EDialogType createEDialogTypeFromString(EDataType eDataType, String initialValue) {
                EDialogType result = EDialogType.get(initialValue);
                if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
                return result;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public String convertEDialogTypeToString(EDataType eDataType, Object instanceValue) {
                return instanceValue == null ? null : instanceValue.toString();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public EConnectionType createEConnectionTypeFromString(EDataType eDataType, String initialValue) {
                EConnectionType result = EConnectionType.get(initialValue);
                if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
                return result;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public String convertEConnectionTypeToString(EDataType eDataType, Object instanceValue) {
                return instanceValue == null ? null : instanceValue.toString();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public EVoiceXmlNames createEVoiceXmlNamesFromString(EDataType eDataType, String initialValue) {
                EVoiceXmlNames result = EVoiceXmlNames.get(initialValue);
                if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
                return result;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public String convertEVoiceXmlNamesToString(EDataType eDataType, Object instanceValue) {
                return instanceValue == null ? null : instanceValue.toString();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public ModelPackage getModelPackage() {
                return (ModelPackage)getEPackage();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @deprecated
         * @generated
         */
	@Deprecated
	public static ModelPackage getPackage() {
                return ModelPackage.eINSTANCE;
        }

} //ModelFactoryImpl
